<?php defined('RUN_KATANA') or die('Restricted access'); ?>
<?php if(defined('AJAX_RUN')): ?>
<?php require('forms/list-items.php'); ?>
<?php else: ?>
<input type="hidden" name="action" value="list_order" />
<input type="hidden" name="delete_order" id="delete_order_id" value="0" />
<input type="hidden" name="export_order" id="export_order_id" value="0" />
<div class="tabs_orders" style="height:100%;">
	<ul>
    	<?php if(intval($_GET['status']) == 0): ?>
    	<li><a href="#orders_new" style="font-size:0.9em;"><?php echo ucfirst($txt->getWord('new_orders')); ?></a></li>
        <?php endif; ?>
        <?php if(intval($_GET['status']) == 1): ?>
    	<li><a href="#orders_pending" style="font-size:0.9em;"><?php echo ucfirst($txt->getWord('pending')); ?></a></li>
        <?php endif; ?>
        <?php if(intval($_GET['status']) == 2): ?>
        <li><a href="#orders_processed" style="font-size:0.9em;"><?php echo ucfirst($txt->getWord('orders_processed')); ?></a></li>
        <?php endif; ?>
	</ul>
    <?php 
	$selected = 0;
	$status = 0; 
	if($_GET['status'] == $status)
	{ 
		?>
        <div id="orders_new"><?php require('forms/list.php'); ?></div>
        <?php
		$selected = $status; 
	}
	 
	$status = 1; 
	if($_GET['status'] == $status)
	{
		$selected = $status; 
		?>
        <div id="orders_pending"><?php require('forms/list.php'); ?></div> 
        <?php 
	}
	
	$status = 2; 
	if($_GET['status'] == $status)
	{ 
		$selected = $status; 
		?>
        <div id="orders_processed"><?php require('forms/list.php'); ?></div> 
        <?php
	}
	?>
</div>
<script type="text/javascript">
jQuery(document).ready(function() 
{
	$( ".tabs_orders" ).tabs({ <?php if($selected != '') { echo 'selected: '.$selected.''; } ?> });
});
function deleteDialog(itemId)
{
	jQuery('#delete_dialog').dialog('open');
	jQuery('#delete_dialog').dialog({
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('customer_order')); ?>': function() 
			{
				jQuery('#delete_order_id').val(itemId);
				jQuery(this).dialog('close');
				jQuery('#edit_form').submit();
			}
		}
	});
}

</script>
<div id="delete_dialog" title="<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('customer_order')); ?>?" style="display:none; text-align:left;"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo ucfirst($txt->getWord('sure_you_want_to_delete')); ?></p></div>
<?php endif; ?>